s_hsSkyBrightness
Creating scenes and oi by sweeping out the skymap brightness.
This takes us from day to night levels. It is used to create a GIF for presentations, showing how the reduction in the sky brightness changes the overall sensor illuminance.
The scenes have with different amounts of sky light, but otherwise the same.
The irradiance axis levels (scale on the right) are set by a function at the end.
(Once the files are all written out, I used Powerpoint to make them into a gif)
See also
Get the scenes
imageID = '1112201236'; % - Good one
lgt = {'headlights','streetlights','otherlights','skymap'};
destPath = fullfile(isethdrsensorRootPath,'data',imageID);
scenes = cell(numel(lgt,1));
thisFile = sprintf('%s_%s.exr',imageID,lgt{ll});
destFile = fullfile(destPath,thisFile);
if ~exist(destFile,"file")
ieWebGet('resourcetype','isethdrsensor',...
'resource name',fullfile('data',imageID,thisFile),...
'download dir',isethdrsensorRootPath);
scenes{ll} = piEXR2ISET(destFile);
Create the optics with some flare
[oi,wvf] = oiCreate('wvf');
% We should implement wvfApertureSet/Get so we do not have to remember
% the parameter names precisely.
params.lineopacity = 0.5;
aperture = wvfAperture(wvf,params);
Loop through the scene skymap levels
% headlights, street lights, other lights, sky map
% wgts = [0.0124 0.0011 0.0010 2.396];
wgts = [0.0124 5*0.0011 3*0.0010 100*2.396];
fprintf('Scene %d, wgts(4) %f\n',ii, wgts(4));
combinedScene = sceneAdd(scenes, wgts);
combinedScene = piAIdenoise(combinedScene);
% Denoising takes some time.
% scene = hsSceneCreate(imageID,'weights',wgts,'denoise',true);
% [scene,wgts] = hsSceneCreate(imageID,'dynamic range',10^5,'low light',10,'denoise',true);
oi = oiCompute(oi, combinedScene,'aperture',aperture,'crop',true, 'pixel size',3e-6);
if ii < 4, oi = oiSet(oi,'gamma',0.7);
else, oi = oiSet(oi,'gamma',0.3);
oiPlot(oi,'illuminance hline rgb',[1 564]);
end
Scene 1, wgts(4) 239.600000
Scene 2, wgts(4) 59.900000
Scene 3, wgts(4) 14.975000
Scene 4, wgts(4) 3.743750
Scene 5, wgts(4) 0.935937
Scene 6, wgts(4) 0.233984
Scene 7, wgts(4) 0.058496
-----------------------------------------
function setAxisAndWrite(cnt)
ax.YAxis(2).Limits = [10^-4,10^4];
n = 7; yTick = logspace(-3,3,n);
yTick = yTick(1:2:n); % Space by 2 log units
fname = sprintf('test-%d.png',cnt);
fname = fullfile(isethdrsensorRootPath,'local',fname);
exportgraphics(ax,fname);